home *** CD-ROM | disk | FTP | other *** search
- using System;
- using System.Drawing;
- using System.Collections;
- using System.ComponentModel;
- using System.Windows.Forms;
-
- namespace DiskWriter
- {
- /// <summary>
- /// Summary description for frmDiskInfo.
- /// </summary>
- public class frmDiskInfo : System.Windows.Forms.Form
- {
- internal System.Windows.Forms.GroupBox GroupBox1;
- internal System.Windows.Forms.Label cdEstUsedSpaceLbl;
- internal System.Windows.Forms.Label Label5;
- internal System.Windows.Forms.Label cdUsedSpaceLbl;
- internal System.Windows.Forms.Label cdStatusLbl;
- internal System.Windows.Forms.Label cdTypeLbl;
- internal System.Windows.Forms.Label Label3;
- internal System.Windows.Forms.Label Label2;
- internal System.Windows.Forms.Label Label1;
- internal System.Windows.Forms.Button RefreshBtn;
- internal System.Windows.Forms.Button EjectBtn;
- internal System.Windows.Forms.Button OKBtn;
- /// <summary>
- /// Required designer variable.
- /// </summary>
- private System.ComponentModel.Container components = null;
-
- public Form1 frm;
-
- public frmDiskInfo()
- {
- //
- // Required for Windows Form Designer support
- //
- InitializeComponent();
-
- //
- // TODO: Add any constructor code after InitializeComponent call
- //
- }
-
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if(components != null)
- {
- components.Dispose();
- }
- }
- base.Dispose( disposing );
- }
-
- #region Windows Form Designer generated code
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this.GroupBox1 = new System.Windows.Forms.GroupBox();
- this.cdEstUsedSpaceLbl = new System.Windows.Forms.Label();
- this.Label5 = new System.Windows.Forms.Label();
- this.cdUsedSpaceLbl = new System.Windows.Forms.Label();
- this.cdStatusLbl = new System.Windows.Forms.Label();
- this.cdTypeLbl = new System.Windows.Forms.Label();
- this.Label3 = new System.Windows.Forms.Label();
- this.Label2 = new System.Windows.Forms.Label();
- this.Label1 = new System.Windows.Forms.Label();
- this.RefreshBtn = new System.Windows.Forms.Button();
- this.EjectBtn = new System.Windows.Forms.Button();
- this.OKBtn = new System.Windows.Forms.Button();
- this.GroupBox1.SuspendLayout();
- this.SuspendLayout();
- //
- // GroupBox1
- //
- this.GroupBox1.Controls.AddRange(new System.Windows.Forms.Control[] {
- this.cdEstUsedSpaceLbl,
- this.Label5,
- this.cdUsedSpaceLbl,
- this.cdStatusLbl,
- this.cdTypeLbl,
- this.Label3,
- this.Label2,
- this.Label1});
- this.GroupBox1.Location = new System.Drawing.Point(8, 8);
- this.GroupBox1.Name = "GroupBox1";
- this.GroupBox1.Size = new System.Drawing.Size(337, 126);
- this.GroupBox1.TabIndex = 1;
- this.GroupBox1.TabStop = false;
- this.GroupBox1.Text = "Disc Total";
- //
- // cdEstUsedSpaceLbl
- //
- this.cdEstUsedSpaceLbl.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
- this.cdEstUsedSpaceLbl.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.cdEstUsedSpaceLbl.Location = new System.Drawing.Point(134, 97);
- this.cdEstUsedSpaceLbl.Name = "cdEstUsedSpaceLbl";
- this.cdEstUsedSpaceLbl.Size = new System.Drawing.Size(191, 18);
- this.cdEstUsedSpaceLbl.TabIndex = 13;
- this.cdEstUsedSpaceLbl.Text = "0";
- this.cdEstUsedSpaceLbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // Label5
- //
- this.Label5.Location = new System.Drawing.Point(14, 99);
- this.Label5.Name = "Label5";
- this.Label5.Size = new System.Drawing.Size(104, 15);
- this.Label5.TabIndex = 12;
- this.Label5.Text = "Est. Space:";
- //
- // cdUsedSpaceLbl
- //
- this.cdUsedSpaceLbl.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
- this.cdUsedSpaceLbl.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.cdUsedSpaceLbl.Location = new System.Drawing.Point(134, 73);
- this.cdUsedSpaceLbl.Name = "cdUsedSpaceLbl";
- this.cdUsedSpaceLbl.Size = new System.Drawing.Size(191, 18);
- this.cdUsedSpaceLbl.TabIndex = 11;
- this.cdUsedSpaceLbl.Text = "0";
- this.cdUsedSpaceLbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // cdStatusLbl
- //
- this.cdStatusLbl.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
- this.cdStatusLbl.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.cdStatusLbl.Location = new System.Drawing.Point(134, 49);
- this.cdStatusLbl.Name = "cdStatusLbl";
- this.cdStatusLbl.Size = new System.Drawing.Size(191, 18);
- this.cdStatusLbl.TabIndex = 10;
- this.cdStatusLbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // cdTypeLbl
- //
- this.cdTypeLbl.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
- this.cdTypeLbl.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.cdTypeLbl.Location = new System.Drawing.Point(134, 26);
- this.cdTypeLbl.Name = "cdTypeLbl";
- this.cdTypeLbl.Size = new System.Drawing.Size(192, 18);
- this.cdTypeLbl.TabIndex = 9;
- this.cdTypeLbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // Label3
- //
- this.Label3.Location = new System.Drawing.Point(14, 76);
- this.Label3.Name = "Label3";
- this.Label3.Size = new System.Drawing.Size(104, 15);
- this.Label3.TabIndex = 8;
- this.Label3.Text = "Used Space:";
- //
- // Label2
- //
- this.Label2.Location = new System.Drawing.Point(14, 52);
- this.Label2.Name = "Label2";
- this.Label2.Size = new System.Drawing.Size(104, 15);
- this.Label2.TabIndex = 7;
- this.Label2.Text = "Status:";
- //
- // Label1
- //
- this.Label1.Location = new System.Drawing.Point(14, 29);
- this.Label1.Name = "Label1";
- this.Label1.Size = new System.Drawing.Size(104, 15);
- this.Label1.TabIndex = 6;
- this.Label1.Text = "Type:";
- //
- // RefreshBtn
- //
- this.RefreshBtn.Location = new System.Drawing.Point(352, 16);
- this.RefreshBtn.Name = "RefreshBtn";
- this.RefreshBtn.Size = new System.Drawing.Size(105, 24);
- this.RefreshBtn.TabIndex = 2;
- this.RefreshBtn.Text = "Refresh";
- this.RefreshBtn.Click += new System.EventHandler(this.RefreshBtn_Click);
- //
- // EjectBtn
- //
- this.EjectBtn.Location = new System.Drawing.Point(352, 48);
- this.EjectBtn.Name = "EjectBtn";
- this.EjectBtn.Size = new System.Drawing.Size(105, 24);
- this.EjectBtn.TabIndex = 4;
- this.EjectBtn.Text = "Eject";
- this.EjectBtn.Click += new System.EventHandler(this.EjectBtn_Click);
- //
- // OKBtn
- //
- this.OKBtn.Location = new System.Drawing.Point(352, 104);
- this.OKBtn.Name = "OKBtn";
- this.OKBtn.Size = new System.Drawing.Size(105, 24);
- this.OKBtn.TabIndex = 5;
- this.OKBtn.Text = "OK";
- this.OKBtn.Click += new System.EventHandler(this.OKBtn_Click);
- //
- // frmDiskInfo
- //
- this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
- this.ClientSize = new System.Drawing.Size(464, 141);
- this.Controls.AddRange(new System.Windows.Forms.Control[] {
- this.OKBtn,
- this.EjectBtn,
- this.RefreshBtn,
- this.GroupBox1});
- this.ImeMode = System.Windows.Forms.ImeMode.Disable;
- this.Name = "frmDiskInfo";
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- this.Text = "frmDiskInfo";
- this.Load += new System.EventHandler(this.frmDiskInfo_Load);
- this.GroupBox1.ResumeLayout(false);
- this.ResumeLayout(false);
-
- }
- #endregion
-
- private void frmDiskInfo_Load(object sender, System.EventArgs e)
- {
- frm = (Form1)this.Owner;
- RefreshFormData();
- }
-
- private void RefreshFormData()
- {
- Int32 w = 0;
- frm.RefreshDiskInfo();
-
- w = (frm.DataCDWriter1.cdUsedSpace / 1024) / 1024;
- cdUsedSpaceLbl.Text = w.ToString() + " MB";
-
-
-
- w = (frm.DataCDWriter1.GetDataVolumeBurnSize() / 1024) / 1024;
- cdEstUsedSpaceLbl.Text = w.ToString() + " MB";
-
- switch(frm.DataCDWriter1.cdType)
- {
- case NCTDISCWRITERLib.CD_TYPE.WRITEONCE:
- {
- cdTypeLbl.Text = "CD-R, CD-ROM";
- EjectBtn.Enabled = true;
- break;
- }
- case NCTDISCWRITERLib.CD_TYPE.ERASABLE:
- {
- cdTypeLbl.Text = "CD-RW";
- EjectBtn.Enabled = true;
- break;
- }
- case NCTDISCWRITERLib.CD_TYPE.RANDOMACCESS:
- {
- cdTypeLbl.Text = "DVD-RAM";
- EjectBtn.Enabled = true;
- break;
- }
- case NCTDISCWRITERLib.CD_TYPE.NODISC:
- {
- cdTypeLbl.Text = "No Disc";
- EjectBtn.Enabled = false;
- cdUsedSpaceLbl.Text = "0";
- break;
- }
- }
-
- switch(frm.DataCDWriter1.cdStatus)
- {
- case NCTDISCWRITERLib.CD_STATUS.BLANK:
- {
- cdStatusLbl.Text = "Blank";
- cdUsedSpaceLbl.Text = "0";
- break;
- }
- case NCTDISCWRITERLib.CD_STATUS.WRITEBLE:
- {
- cdStatusLbl.Text = "Open";
- break;
- }
- case NCTDISCWRITERLib.CD_STATUS.NOTWRITEBLE:
- {
- cdStatusLbl.Text = "Closed";
- break;
- }
-
- case NCTDISCWRITERLib.CD_STATUS.UNRECOGNIZED:
- {
- cdStatusLbl.Text = "Unknown";
- cdUsedSpaceLbl.Text = "0";
- break;
- }
- }
- }
-
- private void RefreshBtn_Click(object sender, System.EventArgs e)
- {
- this.RefreshFormData();
- }
-
- private void EjectBtn_Click(object sender, System.EventArgs e)
- {
- frm.DataCDWriter1.Eject();
- frm.RefreshDiskInfo();
- this.RefreshFormData();
- }
-
- private void OKBtn_Click(object sender, System.EventArgs e)
- {
- this.Hide();
- }
- }
- }
-